Declare Memcached methods as impure#5536
Conversation
|
You've opened the pull request against the latest branch 2.2.x. PHPStan 2.2 is not going to be released for months. If your code is relevant on 2.1.x and you want it to be released sooner, please rebase your pull request and change its target to 2.1.x. |
c49e289 to
673b3c7
Compare
|
This pull request has been marked as ready for review. |
staabm
left a comment
There was a problem hiding this comment.
If I understood #4344 (comment) correctly, it seems some Memcached methods should still be pure
I follow the same strategy than used for Redis in #4422. By default, all the method are marked as impure since it's 99% of them and then if an issue is opened about a specific method we'll update the stubs ; but so far I won't recommend adding complexity by searching for possibly pure method while we're not fully sure about it. |
| /** | ||
| * @phpstan-all-methods-impure | ||
| */ | ||
| class SplFileObject {} |
There was a problem hiding this comment.
should/can SplFileObject::* be removed now from resources/functionMetadata.php?
There was a problem hiding this comment.
This is a test file, it's just to prove that pure annotation is correctly handled for native classes as #5539 (comment)
There was a problem hiding this comment.
I don't understand yet, why we will not ship @phpstan-all-methods-impure for SplFileObject, but do/can for Memcache.
other that that this LGTM
There was a problem hiding this comment.
I didn't know SplFileObject was impure, I never use this class.
I just focus on the open issue.
Feel free to refactor SplFileObject to use @phpstan-all-methods-impure if you want to
There is maybe more class which can be refactored the same way
Closes phpstan/phpstan#13444
Closes #4344
Closes phpstan/phpstan#14534